import BayesClassifier from "../dist/BayesClassifier.js";
let classifier;
export const init = async (json) => {
    classifier = await new Promise((resolve) => {
        BayesClassifier.load(json, null, function (err, classifier) {
            if (err) {
                throw err;
            } else {
                resolve(classifier);
            }
        });
    });
    return classifier.train();
};

export function getType(code) {
    return classifier.classify(code);
}
